]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Call ibusManager.setEngine() with actual layout
authorTakao Fujiwara <tfujiwar@redhat.com>
Wed, 29 Oct 2025 12:34:22 +0000 (21:34 +0900)
committerMarge Bot <marge-bot@gnome.org>
Fri, 19 Dec 2025 20:42:47 +0000 (20:42 +0000)
Currently ibusManager.setEngine() is always called with 'xkb:us::eng'
US layout name but the actual language layout is more useful for IBus.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8490
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3784>

js/misc/ibusManager.js
js/ui/status/keyboard.js

index 0bd282b80c744276715cdd68c71414b0d129f95b..a9178805f495817bd4505d32e8a4ee78f0c00d34 100644 (file)
@@ -27,6 +27,8 @@ const IBUS_SYSTEMD_SERVICE = 'org.freedesktop.IBus.session.GNOME.service';
 
 const TYPING_BOOSTER_ENGINE = 'typing-booster';
 
+const FALLBACK_ENGINE_ID = 'xkb:us::eng';
+
 function _checkIBusVersion(requiredMajor, requiredMinor, requiredMicro) {
     if ((IBus.MAJOR_VERSION > requiredMajor) ||
         (IBus.MAJOR_VERSION === requiredMajor && IBus.MINOR_VERSION > requiredMinor) ||
@@ -282,7 +284,16 @@ class IBusManager extends Signals.EventEmitter {
                 this._MAX_INPUT_SOURCE_ACTIVATION_TIME,
                 this._cancellable);
         } catch (e) {
-            logErrorUnlessCancelled(e);
+            if (!logErrorUnlessCancelled(e))
+                return;
+
+            try {
+                await this._ibus.set_global_engine_async(FALLBACK_ENGINE_ID,
+                    this._MAX_INPUT_SOURCE_ACTIVATION_TIME,
+                    this._cancellable);
+            } catch (e2) {
+                logErrorUnlessCancelled(e2);
+            }
         }
     }
 
index 2f6773c8c097efaf24a612d2795d9e1abd2ec87c..a4d85debdb0e88ed2d4e0625500b3cc760803b15 100644 (file)
@@ -510,17 +510,14 @@ export class InputSourceManager extends Signals.EventEmitter {
             KeyboardManager.holdKeyboard();
         this._keyboardManager.apply(is.xkbId);
 
-        // All the "xkb:..." IBus engines simply "echo" back symbols,
-        // despite their naming implying differently, so we always set
-        // one in order for XIM applications to work given that we set
-        // XMODIFIERS=@im=ibus in the first place so that they can
-        // work without restarting when/if the user adds an IBus input
-        // source.
         let engine;
-        if (is.type === INPUT_SOURCE_TYPE_IBUS)
+        if (is.type === INPUT_SOURCE_TYPE_IBUS) {
             engine = is.id;
-        else
-            engine = 'xkb:us::eng';
+        } else {
+            const [name, variant = ''] = is.id.split('+');
+            const [lang = 'eng'] = this._xkbInfo.get_languages_for_layout(is.id);
+            engine = `xkb:${name}:${variant}:${lang}`;
+        }
 
         this._ibusManager.setEngine(engine).then(() => {
             if (holdKeyboard)